package com.ruoyi.system.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.Ckgz;
import com.ruoyi.system.service.ICkgzService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 工资查看Controller
 * 
 * @author ruoyi
 * @date 2024-01-05
 */
@RestController
@RequestMapping("/ckgz")
public class CkgzController extends BaseController
{
    @Autowired
    private ICkgzService ckgzService;

    /**
     * 查询工资查看列表
     */
    @RequiresPermissions("system:ckgz:list")
    @GetMapping("/list")
    public TableDataInfo list(Ckgz ckgz)
    {
        startPage();
        List<Ckgz> list = ckgzService.selectCkgzList(ckgz);
        return getDataTable(list);
    }

    /**
     * 导出工资查看列表
     */
    @RequiresPermissions("system:ckgz:export")
    @Log(title = "工资查看", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Ckgz ckgz)
    {
        List<Ckgz> list = ckgzService.selectCkgzList(ckgz);
        ExcelUtil<Ckgz> util = new ExcelUtil<Ckgz>(Ckgz.class);
        util.exportExcel(response, list, "工资查看数据");
    }

    /**
     * 获取工资查看详细信息
     */
    @RequiresPermissions("system:ckgz:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(ckgzService.selectCkgzById(id));
    }

    /**
     * 新增工资查看
     */
    @RequiresPermissions("system:ckgz:add")
    @Log(title = "工资查看", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Ckgz ckgz)
    {
        return toAjax(ckgzService.insertCkgz(ckgz));
    }

    /**
     * 修改工资查看
     */
    @RequiresPermissions("system:ckgz:edit")
    @Log(title = "工资查看", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Ckgz ckgz)
    {
        return toAjax(ckgzService.updateCkgz(ckgz));
    }

    /**
     * 删除工资查看
     */
    @RequiresPermissions("system:ckgz:remove")
    @Log(title = "工资查看", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(ckgzService.deleteCkgzByIds(ids));
    }
}
